import { request } from '@/utils/request'
import base from './base'

export const Api = {
  // 用户相关接口
  login(data) {
    return request.post(base.baseUrl + base.login, data)
  },
  register(data) {
    return request.post(base.baseUrl + base.register, data)
  },
  getAllUsers(data) {
    return request.post(base.baseUrl + base.getAllUsers, data)
  },
  getUserById(data) {
    return request.post(base.baseUrl + base.getUserById, data)
  },
  deleteUser(data) {
    return request.post(base.baseUrl + base.deleteUser, data)
  },
  updateUser(data) {
    return request.post(base.baseUrl + base.updateUser, data)
  },
  updateIntroduction(data) {
    return request.post(base.baseUrl + base.updateIntroduction, data)
  },
  updatePassword(data) {
    return request.post(base.baseUrl + base.updatePassword, data)
  },
  uploadXlsxUsers(data) {
    return request.post(base.baseUrl + base.uploadXlsxUsers, data)
  },

  // 管理员相关接口
  getPendingReviewUsers(data) {
    return request.post(base.baseUrl + base.getPendingReviewUsers, data)
  },
  reviewUser(data) {
    return request.post(base.baseUrl + base.reviewUser, data)
  },
  batchReviewUsers(data) {
    return request.post(base.baseUrl + base.batchReviewUsers, data)
  },
  getCounselorApplications(data) {
    return request.post(base.baseUrl + base.getCounselorApplications, data)
  },
  getAssistantApplications(data) {
    return request.post(base.baseUrl + base.getAssistantApplications, data)
  },
  applyForRole(data) {
    return request.post(base.baseUrl + base.applyForRole, data)
  },

  //获取咨询师信息
  getAllCounselors(data) {
    return request.post(base.baseUrl + base.getAllCounselors, data)
  },
  // 预约咨询室相关接口
  //更新咨询师空闲时间
  updateCounselorFreeTime(data) {
    return request.post(base.baseUrl + base.updateCounselorFreeTime, data)
  },
  //添加咨询师空闲时间
  addCounselorFreeTime(data) {
    return request.post(base.baseUrl + base.addCounselorFreeTime, data)
  },
  //获取咨询师空余时间getCounselorFreeTime
  getCounselorFreeTime(data) {
    return request.post(base.baseUrl + base.getCounselorFreeTime, data)
  },
  //咨询教室信息
  getConsultationRoomInfo(data) {
    return request.post(base.baseUrl + base.getConsultationRoomInfo, data)
  },
  //预约咨询室
  bookConsultationRoom(data) {
    return request.post(base.baseUrl + base.bookConsultationRoom, data)
  },
  //咨询信息
  getAllAppointments(data) {
    return request.post(base.baseUrl + base.getAllAppointments, data)
  },
  //获取预约咨询室列表
  getConsultationRoomList(data) {
    return request.post(base.baseUrl + base.getConsultationRoomList, data)
  },
  //更新预约咨询室
  updateConsultationRoom(data) {
    return request.post(base.baseUrl + base.updateConsultationRoom, data)
  },
  //取消预约咨询室
  cancelConsultation(data) {
    return request.post(base.baseUrl + base.cancelConsultation, data)
  },
  //确定预约
  confirmConsultation(data) {
    return request.post(base.baseUrl + base.confirmConsultation, data)
  },
  //通知
  getUserNotifications(data) {
    return request.post(base.baseUrl + base.getUserNotifications, data)
  },
  // 心理知识文章相关接口
  //添加心理知识
  addPsychologyKnowledge(data) {
    return request.post(base.baseUrl + base.addPsychologyKnowledge, data)
  },
  getPsychologyKnowledgeList(data) {
    return request.post(base.baseUrl + base.getPsychologyKnowledgeList, data)
  },
  updatePsychologyKnowledge(data) {
    console.log('调用 updatePsychologyKnowledge 接口，发送数据:', data); // 调试日志
    return request.post(`${base.baseUrl}/api/updatePsychologyKnowledge`, data); // 使用固定 URL
  },
  deletePsychologyKnowledge(data) {
    return request.post(base.baseUrl + base.deletePsychologyKnowledge, data)
  },
  likePsychologyKnowledge(data) {
    return request.post(base.baseUrl + base.likePsychologyKnowledge, data)
  },
  uploadXlsxPsychologyKnowledge(data) {
    return request.post(base.baseUrl + base.uploadXlsxPsychologyKnowledge, data)
  },
  getRandomPsychologyKnowledgeId(data) {
    return request.post(base.baseUrl + base.getRandomPsychologyKnowledgeId, data)
  },
  getPsychologyKnowledgeById(data) {
    return request.post(base.baseUrl+base.getPsychologyKnowledgeById, data);
  },

  // 心理问卷相关接口

  //答题
  submitQuestionnaire(data) {
    return request.post(base.baseUrl + base.submitQuestionnaire, data)
  },
  //获取心理报告
  neratePsychologyReport(data) {
    return request.post(base.baseUrl + base.neratePsychologyReport, data)
  },
  //根据id获取心理报告
  getPsychologyReportDetails(data) {
    return request.post(base.baseUrl + base.getPsychologyReportDetails, data)
  },
  //批量导入试题
  uploadXlsxQuestions(data){
    return request.post(base.baseUrl + base.uploadXlsxQuestions, data)
  },
  //创建问卷
  createQuestionnaire(data) {
    return request.post(base.baseUrl + base.createQuestionnaire, data)
  },
  //获取问卷列表
  getQuestionnaireList(data) {
    return request.post(base.baseUrl + base.getQuestionnaireList, data)
  },
  //更新问卷
  updateQuestionnaire(data) {
    return request.post(base.baseUrl + base.updateQuestionnaire, data)
  },
  //删除问卷
  deleteQuestionnaire(data) {
    return request.post(base.baseUrl + base.deleteQuestionnaire, data)
  },
  //添加题目
  addQuestion(data) {
    return request.post(base.baseUrl + base.addQuestion, data)
  },
  //获取题目列表
  getQuestionList(data) {
    return request.post(base.baseUrl + base.getQuestionList, data)
  },
  //更新题目
  updateQuestion(data) {
    return request.post(base.baseUrl + base.updateQuestion, data)
  },
  //删除题目
  deleteQuestion(data) {
    return request.post(base.baseUrl + base.deleteQuestion, data)
  },
  //添加题目到问卷
  addQuestionToQuestionnaire(data) {
    return request.post(base.baseUrl + base.addQuestionToQuestionnaire, data)
  },
  //删除题目从问卷
  removeQuestionFromQuestionnaire(data) {
    return request.post(base.baseUrl + base.removeQuestionFromQuestionnaire, data)
  },
  //获取问卷题目
  getQuestionnaireQuestions(data) {
    return request.post(base.baseUrl + base.getQuestionnaireQuestions, data)
  },

  //提交问卷
  submitQuestionnaire(data) {
    return request.post(base.baseUrl + base.submitQuestionnaire, data)
  },
  //批改问卷
  gradeQuestionnaire(data) {
    return request.post(base.baseUrl + base.gradeQuestionnaire, data)
  },
  //生成心理报告
  generatePsychologyReport(data) {
    return request.post(base.baseUrl + base.generatePsychologyReport, data)
  },

  // 心理报告相关接口
  //创建心理报告
  createPsychologyReport(data) {
    return request.post(base.baseUrl + base.createPsychologyReport, data)
  },
  //批量导入题目分数段和心理状态关联
  importQuestionScoreRanges(data){
    return request.post(base.baseUrl + base.importQuestionScoreRanges, data)
  },
  //获取分数段列表
  getQuestionScoreRanges(){
    return request.get(base.baseUrl + base.getQuestionScoreRanges)
  },
  //获取用户心理报告
  getUserPsychologyReports(data) {
    return request.post(base.baseUrl + base.getUserPsychologyReports, data)
  },
  //更新心理报告
  updatePsychologyReport(data) {
    return request.post(base.baseUrl + base.updatePsychologyReport, data)
  },
  //删除心理报告
  deletePsychologyReport(data) {
    return request.post(base.baseUrl + base.deletePsychologyReport, data)
  },

  // 文件上传相关接口
  uploadFiles(data) {
    return request.post(base.baseUrl + base.uploadFiles, data)
  },
}

// 心理知识文章相关接口
export const articleApi = {
  getArticleById: (id) => request.post(base.baseUrl + base.getPsychologyKnowledgeList, { id }),
  // ...其他文章相关接口...
}
